From f7c849297723bb39226cdae61c3e6dcf29ae87a6 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Sun, 29 Jul 2007 19:55:13 +0000 Subject: [PATCH] ozi: Fix removal of filename extension. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@2930 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/ozi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gpsbabel/ozi.c b/gpsbabel/ozi.c index 4b16981a9..514cdcfc7 100644 --- a/gpsbabel/ozi.c +++ b/gpsbabel/ozi.c @@ -114,7 +114,7 @@ ozi_alloc_fsdata(void) static void ozi_openfile(char *fname) { - char *c, *tmpname; + char *c, *cx, *tmpname; char *ozi_extensions[] = {0, "plt", "wpt", "rte"}; char buff[32]; @@ -137,6 +137,8 @@ ozi_openfile(char *fname) { /* remove extension and add buff + ozi's extension */ c = strrchr(fname, '.'); + if (c && (cx = strrchr(fname, '/')) && (cx > c)) c = NULL; + if (c && (cx = strrchr(fname, '\\')) && (cx > c)) c = NULL; if (c == NULL) c = fname + strlen(fname); xasprintf(&tmpname, "%*.*s%s.%s", c - fname, c - fname, fname, buff, ozi_extensions[ozi_objective]); -- 2.30.2